package database.utils;

public class JUtils {
    public static boolean judgeExistOption(boolean isNX, boolean isXX) {
        return !(isNX && isXX);
    }
    public static boolean judgeTTLOptions(boolean isEX, boolean isPX, boolean isEXAT, boolean isPXAT, boolean isKEEPTTL) {
        return (!isEX && !isPX && !isEXAT && !isPXAT && !isKEEPTTL) ||
                (isEX && !isPX && !isEXAT && !isPXAT && !isKEEPTTL) ||
                (!isEX && isPX && !isEXAT && !isPXAT && !isKEEPTTL) ||
                (!isEX && !isPX && isEXAT && !isPXAT && !isKEEPTTL) ||
                (!isEX && !isPX && !isEXAT && isPXAT && !isKEEPTTL) ||
                (!isEX && !isPX && !isEXAT && !isPXAT && isKEEPTTL);
    }

    public static String[] makeExpireCmd(String key, long timestampInMS) {
        return new String[]{
                "pexpireat", key, Long.toString(timestampInMS)
        };
    }
}
